/*
 *  MTouchware_handlers.h
 *
 *  Header of MTouchware_handlers.c that handles messages 
 *  received via the TUIO_receiver.
 *
 *  Copyright (C) 2010 LIMSI-CNRS (Orsay-France) and EFREI (Paris-France)
 *
 *  Authors: Rami Ajaj, Nicolas Flasque and Frederic Vernier.
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as
 *  published by the Free Software Foundation; either version 2.1 of the
 *  License, or (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  $Id$
 */

#ifndef MTOUCHWARE_HANDLERS_H
#define MTOUCHWARE_HANDLERS_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifndef WIN32
  #include <pthread.h>
  #include <unistd.h>
#else 
  #include "pthread/pthread.h"
//  #include <time.h>
#endif

#include "lo/lo.h"
#include "MTouchware_senders.h"



/**
 * \defgroup MTouchware handlers
 *
 * Handlers for received TUIO messages
 * @{
 */

/**
 * Note TUIO parameters: 
 * s	 	Session ID (temporary object ID) 						int32
 * i 		Class ID (e.g. marker ID) 								int32
 * x, y, z 	Position 												float32, range 0...1
 * a, b, c 	Angle 													float32, range 0..2PI
 * w, h, d 	Dimension 												float32, range 0..1
 * f, v 	Area, Volume 											float32, range 0..1
 * X, Y ,Z 	Velocity vector (motion speed & direction) 				float32
 * A, B, C 	Rotation velocity vector (rotation speed & direction) 	float32
 * m 		Motion acceleration 									float32
 * r 		Rotation acceleration 									float32
 * P 		Free parameter 											type defined by OSC message header
 */

/**
 * \brief Handles message /tuio/2Dcur set s x y X Y m.
 *
 * \param path char* specifying the path of the message "/tuio/2Dcur".
 * \param types char* specifying types of arguments this message handles "sifffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio2Dcur_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/**
 * \brief Handles message /tuio/25Dcur set s x y z X Y Z m.
 *
 * \param path char* specifying the path of the message "/tuio/25Dcur".
 * \param types char* specifying types of arguments this message handles "sifffffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio25Dcur_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/**
 * \brief Handles message /tuio/3Dcur set s x y z X Y Z m.
 *
 * \param path char* specifying the path of the message "/tuio/3Dcur".
 * \param types char* specifying types of arguments this message handles "sifffffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio3Dcur_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/**
 * \brief Handles message /tuio/2Dobj set s i x y a X Y A m r.
 *
 * \param path char* specifying the path of the message "/tuio/2Dobj".
 * \param types char* specifying types of arguments this message handles "siiffffffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio2Dobj_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/**
 * \brief Handles message /tuio/25Dobj set s i x y z a X Y Z A m r.
 *
 * \param path char* specifying the path of the message "/tuio/25Dobj".
 * \param types char* specifying types of arguments this message handles "siiffffffffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio25Dobj_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/**
 * \brief Handles message /tuio/3Dobj set s i x y z a b c X Y Z A B C m r.
 *
 * \param path char* specifying the path of the message "/tuio/3Dobj".
 * \param types char* specifying types of arguments this message handles "siiffffffffffffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio3Dobj_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/**
 * \brief Handles message /tuio/2Dblb set s x y a w h f X Y A m r.
 *
 * \param path char* specifying the path of the message "/tuio/2Dblb".
 * \param types char* specifying types of arguments this message handles "sifffffffffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio2Dblb_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/**
 * \brief Handles message /tuio/25Dblb set s x y z a w h f X Y Z A m r.
 *
 * \param path char* specifying the path of the message "/tuio/25blb".
 * \param types char* specifying types of arguments this message handles "sifffffffffffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio25Dblb_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/**
 * \brief Handles message /tuio/3Dblb set s x y z a b c w h d v X Y Z A B C m r.
 *
 * \param path char* specifying the path of the message "/tuio/3Dblb".
 * \param types char* specifying types of arguments this message handles "siffffffffffffffffff".
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int tuio3Dblb_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);


/**
 * \brief Handles any OSC message.
 *
 * \param path char* specifying the path of the message.
 * \param types char* specifying types of arguments this message handles.
 * \param argv char** specifying the arguments of the message.
 * \param argc integer specifying the number of arguments.
 * \param data A value passed from the method that invoked this callback method.
 * \param user_data A value passed from the method that invoked this callback method.
 * \return An integer. Returning 1 means that the message has not been
 *  fully handled and the server should try other methods.
 *
 */
int generic_handler(const char *path, const char *types, lo_arg **argv,
		    int argc, void *data, void *user_data);

/** @} */
#ifdef __cplusplus
}
#endif

#endif
